package ControlLayer;
import ModelLayer.Category;
import DBLayer.DBCategory;
import java.util.ArrayList;

public class CtrCategory {
    // <editor-fold defaultstate="collapsed" desc="Attributes & Constructors">
    private static CtrCategory instance = null;
    DBCategory dbCategory = new DBCategory();

    public CtrCategory() {
    }
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Methods">
    public static CtrCategory getInstance() {
        if (instance == null) {
            instance = new CtrCategory();
        }
        return instance;
    }

    public ArrayList<Category> getCategoryList() {
        return dbCategory.getCategoryList();
    }

    public Category getCategoryByID(int id) {
        return dbCategory.getCategoryByID(id);
    }

    public int addCategory(Category category) {
        return dbCategory.addCategory(category);
    }

    public int updateCategory(Category category, int id) {
        return dbCategory.updateCategory(category, id);
    }

    public void deleteCategory(int id) {
        dbCategory.deleteCategory(id);
    }
    // </editor-fold>
}
